package cn.madis.ymcc.doc;

import com.baomidou.mybatisplus.annotations.TableField;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 针对于  Employee 表的文档映射
 * indexName：索引库
 * type：类型(表类型)
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Document(indexName = "course",type = "_doc")
public class CourseDoc {
    @Id
    private Long id;

    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_max_word")//分词
    private String name;

    @Field(type = FieldType.Keyword)//不分词
    private String gradeName;

    /**
     * 销量
     */
    @Field(type = FieldType.Integer)
    private Integer saleCount;
    /**
     * 浏览量
     */
    @Field(type = FieldType.Integer)
    private Integer viewCount;
    /**
     * 评论数
     */
    @Field(type = FieldType.Integer)
    private Integer commentCount;

    /**
     * 收费规则：，收费1免费，2收费
     */
    /*@Field(type = FieldType.Keyword)//不分词
    private String charge;*/

    @Field(type = FieldType.Keyword)//不分词
    private String chargeName;

    /**
     * 价格
     */
    @Field(type = FieldType.Double)
    private BigDecimal price;
    /**
     * 原价
     */
    @Field(type = FieldType.Double)
    private BigDecimal priceOld;

    @Field(type = FieldType.Integer)
    private Integer validDays;

    /**
     * 适用人群
     */
    @Field(type = FieldType.Keyword)//不分词
    private String forUser;

    /**
     * 课程的开课时间
     */
    @Field(type = FieldType.Date)
    private Date startTime;
    /**
     * 课程的节课时间
     */
    @Field(type = FieldType.Date)
    private Date endTime;
    /**
     * 封面，云存储地址
     */
    @Field(type = FieldType.Keyword)//不分词
    private String pic;
    /**
     * 时长，以分钟为单位
     */
    @Field(type = FieldType.Integer)
    private Integer totalMinute;

    @Field(type = FieldType.Date)
    private Date onlineTime;
    /**
     * 章节数
     */
    @Field(type = FieldType.Integer)
    private Integer chapterCount;
    /**
     * 讲师，逗号分隔多个
     */
    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_max_word")//分词
    private String teacherNames;

    /**
     * 课程分类
     */
    @Field(type = FieldType.Text,analyzer = "ik_max_word",searchAnalyzer = "ik_max_word")//分词
    private String courseTypeName;

    /**
     * 课程分类
     */
    @Field(type = FieldType.Long)
    private Long courseTypeId;

}
